#include "dealer.h"
#include "random.h"
#include <iostream>
#include <cstdlib>
using namespace std;

Dealer::Dealer()
{
	mTotal = 0;
	mInsurance = 0;
}
int Dealer::deal(char card_c1, char card_c2)
{
	
	int card1=0,card2=0,value=0;
	value = card1 + card2;
	if(card_c1 == 11 || card_c2 == 11)
	{
		if(value > 21)
			value -= 10;
	}
	return value;
}

int Dealer::game(int value)
{
	int card = 0;

	while(value < 17)
	{
		//card = Random(1, 14);

		if(card == 12)
		{
			value -= 2;
		}
		else if(card == 13)
		{
			value -= 3;
		}
		else if(card == 14)
		{
			value -= 4;
		}

		value += card;

		if(card == 11 && value > 21)
		{
			card -= 10;
		}

		if(value > 21)
		{
			cout << "\nDealer Busts!" << endl;
		}
	}
	return value;
}

int Dealer::getTotal()
{
	return mTotal;
}

void Dealer::setTotal(int total)
{
	mTotal = total;
}

int Dealer::getInsurance()
{
	return mInsurance;
}

void Dealer::setInsurance(int add)
{
	mInsurance = add;
}
